<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue 3 仪表盘应用</title>
    <!-- 引入Vue 3 -->
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <!-- 引入Font Awesome -->
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    
    <style>
        :root {
            --primary-color: #4285f4;
            --secondary-color: #34a853;
            --accent-color: #ea4335;
            --text-color: #202124;
            --text-secondary: #5f6368;
            --background-color: #f8f9fa;
            --card-background: #ffffff;
            --border-color: #dadce0;
            --sidebar-width: 240px;
            --header-height: 60px;
            --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            --transition: all 0.3s ease;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            line-height: 1.6;
            color: var(--text-color);
            background-color: var(--background-color);
            min-height: 100vh;
            overflow-x: hidden;
        }
        
        /* 主容器 */
        .app-container {
            display: flex;
            min-height: 100vh;
            transition: var(--transition);
        }
        
        /* 侧边栏 */
        .sidebar {
            width: var(--sidebar-width);
            background-color: var(--card-background);
            box-shadow: var(--shadow);
            position: fixed;
            top: 0;
            left: 0;
            height: 100vh;
            overflow-y: auto;
            padding-top: var(--header-height);
            transition: var(--transition);
            z-index: 100;
        }
        
        .sidebar.collapsed {
            width: 70px;
        }
        
        .sidebar-header {
            padding: 20px;
            text-align: center;
            border-bottom: 1px solid var(--border-color);
        }
        
        .sidebar.collapsed .sidebar-header h2 {
            display: none;
        }
        
        .sidebar-nav {
            padding: 20px 0;
        }
        
        .nav-item {
            display: flex;
            align-items: center;
            padding: 12px 20px;
            color: var(--text-secondary);
            text-decoration: none;
            transition: var(--transition);
            cursor: pointer;
        }
        
        .nav-item:hover {
            background-color: rgba(66, 133, 244, 0.1);
            color: var(--primary-color);
        }
        
        .nav-item.active {
            background-color: rgba(66, 133, 244, 0.1);
            color: var(--primary-color);
            border-left: 3px solid var(--primary-color);
        }
        
        .nav-item i {
            font-size: 20px;
            width: 24px;
            text-align: center;
            margin-right: 16px;
        }
        
        .sidebar.collapsed .nav-text {
            display: none;
        }
        
        .sidebar.collapsed .nav-item i {
            margin-right: 0;
        }
        
        /* 主内容区 */
        .main-content {
            flex: 1;
            margin-left: var(--sidebar-width);
            padding-top: var(--header-height);
            transition: var(--transition);
        }
        
        .sidebar.collapsed + .main-content {
            margin-left: 70px;
        }
        
        /* 头部导航 */
        .header {
            position: fixed;
            top: 0;
            left: var(--sidebar-width);
            right: 0;
            height: var(--header-height);
            background-color: var(--card-background);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 20px;
            transition: var(--transition);
            z-index: 90;
        }
        
        .sidebar.collapsed ~ .header {
            left: 70px;
        }
        
        .header-left {
            display: flex;
            align-items: center;
        }
        
        .sidebar-toggle {
            background: none;
            border: none;
            font-size: 20px;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 8px;
            border-radius: 4px;
            transition: var(--transition);
        }
        
        .sidebar-toggle:hover {
            background-color: var(--background-color);
            color: var(--primary-color);
        }
        
        .header-title {
            margin-left: 16px;
            font-size: 18px;
            font-weight: 500;
        }
        
        .header-right {
            display: flex;
            align-items: center;
            gap: 16px;
        }
        
        .search-bar {
            position: relative;
        }
        
        .search-bar input {
            padding: 8px 16px 8px 36px;
            border: 1px solid var(--border-color);
            border-radius: 24px;
            outline: none;
            width: 240px;
            transition: var(--transition);
        }
        
        .search-bar input:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
        }
        
        .search-bar i {
            position: absolute;
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
        }
        
        .notification-btn {
            position: relative;
            background: none;
            border: none;
            font-size: 20px;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 8px;
            border-radius: 4px;
            transition: var(--transition);
        }
        
        .notification-btn:hover {
            background-color: var(--background-color);
            color: var(--primary-color);
        }
        
        .notification-badge {
            position: absolute;
            top: 4px;
            right: 4px;
            background-color: var(--accent-color);
            color: white;
            font-size: 10px;
            padding: 2px 6px;
            border-radius: 10px;
            min-width: 16px;
            text-align: center;
        }
        
        .user-profile {
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background-color: var(--primary-color);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 500;
        }
        
        .user-info {
            display: flex;
            flex-direction: column;
        }
        
        .user-name {
            font-size: 14px;
            font-weight: 500;
        }
        
        .user-role {
            font-size: 12px;
            color: var(--text-secondary);
        }
        
        /* 页面内容 */
        .page-content {
            padding: 24px;
        }
        
        .page-header {
            margin-bottom: 24px;
        }
        
        .page-header h1 {
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 8px;
        }
        
        .page-header p {
            color: var(--text-secondary);
        }
        
        /* 卡片网格 */
        .card-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 20px;
            margin-bottom: 32px;
        }
        
        .stat-card {
            background-color: var(--card-background);
            border-radius: 8px;
            padding: 24px;
            box-shadow: var(--shadow);
            transition: var(--transition);
        }
        
        .stat-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }
        
        .stat-card-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 16px;
        }
        
        .stat-title {
            font-size: 14px;
            color: var(--text-secondary);
            font-weight: 500;
        }
        
        .stat-icon {
            width: 40px;
            height: 40px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            color: white;
        }
        
        .stat-icon.primary {
            background-color: var(--primary-color);
        }
        
        .stat-icon.secondary {
            background-color: var(--secondary-color);
        }
        
        .stat-icon.accent {
            background-color: var(--accent-color);
        }
        
        .stat-icon.warning {
            background-color: #fbbc05;
        }
        
        .stat-value {
            font-size: 28px;
            font-weight: 600;
            margin-bottom: 4px;
        }
        
        .stat-change {
            font-size: 14px;
            display: flex;
            align-items: center;
        }
        
        .stat-change.positive {
            color: var(--secondary-color);
        }
        
        .stat-change.negative {
            color: var(--accent-color);
        }
        
        /* 图表和数据区域 */
        .charts-container {
            display: grid;
            grid-template-columns: 2fr 1fr;
            gap: 20px;
            margin-bottom: 32px;
        }
        
        .chart-card {
            background-color: var(--card-background);
            border-radius: 8px;
            padding: 24px;
            box-shadow: var(--shadow);
        }
        
        .chart-card h3 {
            margin-bottom: 20px;
            font-size: 18px;
            font-weight: 500;
        }
        
        .chart-placeholder {
            height: 300px;
            background-color: var(--background-color);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-secondary);
            font-size: 14px;
            border: 2px dashed var(--border-color);
        }
        
        /* 最近活动表格 */
        .recent-activities {
            background-color: var(--card-background);
            border-radius: 8px;
            padding: 24px;
            box-shadow: var(--shadow);
            margin-bottom: 32px;
        }
        
        .recent-activities h3 {
            margin-bottom: 20px;
            font-size: 18px;
            font-weight: 500;
        }
        
        .activity-table {
            width: 100%;
            border-collapse: collapse;
        }
        
        .activity-table th,
        .activity-table td {
            padding: 12px 16px;
            text-align: left;
            border-bottom: 1px solid var(--border-color);
        }
        
        .activity-table th {
            font-weight: 500;
            color: var(--text-secondary);
            font-size: 14px;
        }
        
        .activity-table tr:hover {
            background-color: var(--background-color);
        }
        
        .activity-status {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 500;
        }
        
        .activity-status.success {
            background-color: rgba(52, 168, 83, 0.1);
            color: var(--secondary-color);
        }
        
        .activity-status.pending {
            background-color: rgba(251, 188, 5, 0.1);
            color: #fbbc05;
        }
        
        .activity-status.failed {
            background-color: rgba(234, 67, 53, 0.1);
            color: var(--accent-color);
        }
        
        /* 任务卡片 */
        .tasks-container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 20px;
        }
        
        .task-card {
            background-color: var(--card-background);
            border-radius: 8px;
            padding: 24px;
            box-shadow: var(--shadow);
        }
        
        .task-card h3 {
            margin-bottom: 16px;
            font-size: 18px;
            font-weight: 500;
        }
        
        .task-list {
            list-style: none;
        }
        
        .task-item {
            display: flex;
            align-items: center;
            padding: 12px 0;
            border-bottom: 1px solid var(--border-color);
        }
        
        .task-item:last-child {
            border-bottom: none;
        }
        
        .task-checkbox {
            margin-right: 12px;
            transform: scale(1.2);
        }
        
        .task-content {
            flex: 1;
        }
        
        .task-title {
            font-weight: 500;
            margin-bottom: 4px;
        }
        
        .task-meta {
            font-size: 12px;
            color: var(--text-secondary);
        }
        
        /* 页脚 */
        .footer {
            padding: 20px 24px;
            background-color: var(--card-background);
            border-top: 1px solid var(--border-color);
            color: var(--text-secondary);
            font-size: 14px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .footer-links {
            display: flex;
            gap: 16px;
        }
        
        .footer-links a {
            color: var(--text-secondary);
            text-decoration: none;
            transition: var(--transition);
        }
        
        .footer-links a:hover {
            color: var(--primary-color);
        }
        
        /* 响应式设计 */
        @media (max-width: 1200px) {
            .charts-container {
                grid-template-columns: 1fr;
            }
        }
        
        @media (max-width: 768px) {
            .sidebar {
                transform: translateX(-100%);
            }
            
            .sidebar.active {
                transform: translateX(0);
            }
            
            .main-content,
            .header {
                margin-left: 0;
                left: 0;
            }
            
            .card-grid {
                grid-template-columns: 1fr;
            }
            
            .header-right {
                gap: 8px;
            }
            
            .search-bar {
                display: none;
            }
            
            .user-info {
                display: none;
            }
        }
        
        /* 动画效果 */
        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .fade-in {
            animation: fadeIn 0.5s ease-out;
        }
    </style>
</head>
<body>
    <div id="app" class="app-container">
        <!-- 侧边栏 -->
        <aside :class="['sidebar', { collapsed: sidebarCollapsed }]">
            <div class="sidebar-header">
                <h2>Vue Dashboard</h2>
            </div>
            <nav class="sidebar-nav">
                <div v-for="item in sidebarItems" :key="item.id"
                     :class="['nav-item', { active: activeItem === item.id }]"
                     @click="activeItem = item.id">
                    <i :class="item.icon"></i>
                    <span class="nav-text">{{ item.text }}</span>
                </div>
            </nav>
        </aside>
        
        <!-- 主内容区 -->
        <main class="main-content">
            <!-- 头部导航 -->
            <header class="header">
                <div class="header-left">
                    <button class="sidebar-toggle" @click="toggleSidebar">
                        <i class="fa" :class="sidebarCollapsed ? 'fa-angle-right' : 'fa-angle-left'"></i>
                    </button>
                    <h2 class="header-title">{{ pageTitle }}</h2>
                </div>
                <div class="header-right">
                    <div class="search-bar">
                        <i class="fa fa-search"></i>
                        <input type="text" placeholder="搜索...">
                    </div>
                    <button class="notification-btn">
                        <i class="fa fa-bell"></i>
                        <span class="notification-badge">{{ notificationCount }}</span>
                    </button>
                    <div class="user-profile">
                        <div class="avatar">{{ userName.charAt(0) }}</div>
                        <div class="user-info">
                            <div class="user-name">{{ userName }}</div>
                            <div class="user-role">{{ userRole }}</div>
                        </div>
                    </div>
                </div>
            </header>
            
            <!-- 页面内容 -->
            <div class="page-content">
                <div class="page-header">
                    <h1>{{ pageTitle }}</h1>
                    <p>{{ pageSubtitle }}</p>
                </div>
                
                <!-- 统计卡片 -->
                <div class="card-grid">
                    <div v-for="stat in statistics" :key="stat.id" class="stat-card fade-in">
                        <div class="stat-card-header">
                            <span class="stat-title">{{ stat.title }}</span>
                            <div :class="['stat-icon', stat.type]">
                                <i :class="stat.icon"></i>
                            </div>
                        </div>
                        <div class="stat-value">{{ stat.value }}</div>
                        <div :class="['stat-change', stat.changeType]">
                            <i :class="stat.changeType === 'positive' ? 'fa fa-arrow-up' : 'fa fa-arrow-down'"></i>
                            {{ stat.changeValue }}%
                        </div>
                    </div>
                </div>
                
                <!-- 图表区域 -->
                <div class="charts-container">
                    <div class="chart-card fade-in">
                        <h3>销售趋势</h3>
                        <div class="chart-placeholder">
                            <i class="fa fa-line-chart" style="font-size: 48px; margin-bottom: 16px;"></i>
                            <p>销售数据图表</p>
                        </div>
                    </div>
                    <div class="chart-card fade-in">
                        <h3>用户分布</h3>
                        <div class="chart-placeholder">
                            <i class="fa fa-pie-chart" style="font-size: 48px; margin-bottom: 16px;"></i>
                            <p>用户分布图表</p>
                        </div>
                    </div>
                </div>
                
                <!-- 最近活动 -->
                <div class="recent-activities fade-in">
                    <h3>最近活动</h3>
                    <table class="activity-table">
                        <thead>
                            <tr>
                                <th>活动</th>
                                <th>用户</th>
                                <th>时间</th>
                                <th>状态</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr v-for="activity in recentActivities" :key="activity.id">
                                <td>{{ activity.description }}</td>
                                <td>{{ activity.user }}</td>
                                <td>{{ activity.time }}</td>
                                <td>
                                    <span :class="['activity-status', activity.status]">
                                        {{ activity.statusText }}
                                    </span>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                
                <!-- 任务卡片 -->
                <div class="tasks-container">
                    <div class="task-card fade-in">
                        <h3>待办任务</h3>
                        <ul class="task-list">
                            <li v-for="task in pendingTasks" :key="task.id" class="task-item">
                                <input type="checkbox" class="task-checkbox">
                                <div class="task-content">
                                    <div class="task-title">{{ task.title }}</div>
                                    <div class="task-meta">{{ task.dueDate }} • {{ task.priority }}</div>
                                </div>
                            </li>
                        </ul>
                    </div>
                    <div class="task-card fade-in">
                        <h3>进行中任务</h3>
                        <ul class="task-list">
                            <li v-for="task in inProgressTasks" :key="task.id" class="task-item">
                                <input type="checkbox" class="task-checkbox" :checked="false">
                                <div class="task-content">
                                    <div class="task-title">{{ task.title }}</div>
                                    <div class="task-meta">{{ task.assignee }} • {{ task.progress }}%</div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            
            <!-- 页脚 -->
            <footer class="footer">
                <div>© 2023 Vue Dashboard. 保留所有权利。</div>
                <div class="footer-links">
                    <a href="#">关于我们</a>
                    <a href="#">帮助中心</a>
                    <a href="#">隐私政策</a>
                </div>
            </footer>
        </main>
    </div>
    
    <script>
        const app = Vue.createApp({
            data() {
                return {
                    // 侧边栏状态
                    sidebarCollapsed: false,
                    activeItem: 'dashboard',
                    
                    // 页面信息
                    pageTitle: '仪表盘',
                    pageSubtitle: '欢迎回来，这是您的个人仪表盘',
                    
                    // 用户信息
                    userName: '张三',
                    userRole: '管理员',
                    notificationCount: 5,
                    
                    // 侧边栏菜单
                    sidebarItems: [
                        { id: 'dashboard', text: '仪表盘', icon: 'fa fa-tachometer' },
                        { id: 'users', text: '用户管理', icon: 'fa fa-users' },
                        { id: 'products', text: '产品管理', icon: 'fa fa-cubes' },
                        { id: 'orders', text: '订单管理', icon: 'fa fa-shopping-cart' },
                        { id: 'analytics', text: '数据分析', icon: 'fa fa-bar-chart' },
                        { id: 'settings', text: '系统设置', icon: 'fa fa-cog' },
                        { id: 'help', text: '帮助中心', icon: 'fa fa-question-circle' }
                    ],
                    
                    // 统计数据
                    statistics: [
                        {
                            id: 'stat1',
                            title: '总用户数',
                            value: '1,280',
                            changeValue: '+12.5',
                            changeType: 'positive',
                            icon: 'fa fa-users',
                            type: 'primary'
                        },
                        {
                            id: 'stat2',
                            title: '总销售额',
                            value: '¥32,540',
                            changeValue: '+8.3',
                            changeType: 'positive',
                            icon: 'fa fa-money',
                            type: 'secondary'
                        },
                        {
                            id: 'stat3',
                            title: '订单数量',
                            value: '284',
                            changeValue: '-2.1',
                            changeType: 'negative',
                            icon: 'fa fa-shopping-cart',
                            type: 'accent'
                        },
                        {
                            id: 'stat4',
                            title: '转化率',
                            value: '4.8%',
                            changeValue: '+1.2',
                            changeType: 'positive',
                            icon: 'fa fa-exchange',
                            type: 'warning'
                        }
                    ],
                    
                    // 最近活动
                    recentActivities: [
                        {
                            id: 'activity1',
                            description: '用户注册',
                            user: '李四',
                            time: '今天 10:23',
                            status: 'success',
                            statusText: '成功'
                        },
                        {
                            id: 'activity2',
                            description: '订单支付',
                            user: '王五',
                            time: '今天 09:45',
                            status: 'pending',
                            statusText: '处理中'
                        },
                        {
                            id: 'activity3',
                            description: '系统更新',
                            user: '系统',
                            time: '昨天 18:30',
                            status: 'success',
                            statusText: '成功'
                        },
                        {
                            id: 'activity4',
                            description: '登录尝试',
                            user: '未知',
                            time: '昨天 14:12',
                            status: 'failed',
                            statusText: '失败'
                        }
                    ],
                    
                    // 待办任务
                    pendingTasks: [
                        {
                            id: 'task1',
                            title: '更新产品价格',
                            dueDate: '今天到期',
                            priority: '高'
                        },
                        {
                            id: 'task2',
                            title: '回复客户邮件',
                            dueDate: '今天到期',
                            priority: '中'
                        },
                        {
                            id: 'task3',
                            title: '生成每周报告',
                            dueDate: '明天到期',
                            priority: '中'
                        }
                    ],
                    
                    // 进行中任务
                    inProgressTasks: [
                        {
                            id: 'task4',
                            title: '网站改版',
                            assignee: '赵六',
                            progress: 65
                        },
                        {
                            id: 'task5',
                            title: 'API 开发',
                            assignee: '孙七',
                            progress: 42
                        },
                        {
                            id: 'task6',
                            title: '性能优化',
                            assignee: '周八',
                            progress: 88
                        }
                    ]
                }
            },
            
            methods: {
                // 切换侧边栏
                toggleSidebar() {
                    this.sidebarCollapsed = !this.sidebarCollapsed;
                },
                
                // 处理侧边栏项目点击
                handleSidebarClick(itemId) {
                    this.activeItem = itemId;
                    // 根据选中的项目更新页面标题
                    const selectedItem = this.sidebarItems.find(item => item.id === itemId);
                    if (selectedItem) {
                        this.pageTitle = selectedItem.text;
                        this.pageSubtitle = `这是${selectedItem.text}页面`;
                    }
                }
            },
            
            // 监听侧边栏项目变化
            watch: {
                activeItem(newValue) {
                    this.handleSidebarClick(newValue);
                }
            }
        });
        
        app.mount('#app');
    </script>
</body>
</html>